﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace GeoPlugin
{
    /// <summary>
    /// Interaction logic for ObjectControl.xaml
    /// </summary>
    public partial class ObjectControl : UserControl
    {
        private EarthViewBox objectViewBox;
        public Rectangle rotateRectangle, zoomRectangle;
        public Slider zoomSlider;
        
        public ObjectControl()
        {
            InitializeComponent();
            DataContext = PluginModel.Instance;
            objectViewBox = new EarthViewBox();
            objectViewBox.Opacity = 0.7;
            //zoomSlider = new Slider();
            //zoomSlider.Maximum = 200;
            //zoomSlider.Minimum = -200;
            //zoomSlider.Height = 500;
            //zoomSlider.Width = 100;
            //zoomSlider.Style = (Style)this.Resources.FindName("SliderThumbStyle");
            //zoomSlider.Orientation = Orientation.Vertical;
            //zoomSlider.VerticalAlignment = VerticalAlignment.Center;
            //zoomSlider.HorizontalAlignment = HorizontalAlignment.Left;
            zoomRectangle = new Rectangle();
            zoomRectangle.Width = 100;
            zoomRectangle.Height = 700;
            zoomRectangle.Fill = Brushes.Gray;
            zoomRectangle.Opacity = 0.4;
            zoomRectangle.HorizontalAlignment = HorizontalAlignment.Left;
            zoomRectangle.Margin = new Thickness(20, 0, 0, 0);
            
            rotateRectangle = new Rectangle();
            rotateRectangle.HorizontalAlignment = HorizontalAlignment.Stretch;
            rotateRectangle.VerticalAlignment = VerticalAlignment.Stretch;
            rotateRectangle.Opacity = 0;

            objectViewBox.Loaded += new RoutedEventHandler(objectViewBox_Loaded);

            this.MainGrid.Children.Add(zoomRectangle);
            this.MainGrid.Children.Add(rotateRectangle);
            this.MainGrid.Children.Add(objectViewBox);
        }

        void objectViewBox_Loaded(object sender, RoutedEventArgs e)
        {
            objectViewBox.setTrackBallSource(zoomRectangle);
        }
    }
}
